package com.arp.dao;

import android.content.ContentProvider;
import android.content.ContentValues;
import android.database.Cursor;
import android.net.Uri;
import android.provider.BaseColumns;

public class Tables {
	public static final String AUTHORITY = "com.arp.miniproject";
	
	private Dao dao;
	
	public static final class ShopList implements BaseColumns {
		public static String _NAME = "Name";
		
		public static final String TABLE_NAME = "ShopList";
		
		

        private static final String PATH_NOTES = "/ShopList";
        private static final String PATH_NOTE_ID = "/ShopList/";
        /*** 0-relative position of a note ID segment in the path part of a note ID URI */
        public static final int NAME_ID_PATH_POSITION = 1;
        
        /*** The content:// style URL for this table*/
        public static final Uri CONTENT_URI =  Uri.parse(SCHEME + AUTHORITY + PATH_NOTES);

        /*** The content URI base for a single note. Callers must * append a numeric note id to this Uri to retrieve a note */
        public static final Uri CONTENT_ID_URI_BASE = Uri.parse(SCHEME + AUTHORITY + PATH_NOTE_ID);

        /*** The content URI match pattern for a single note, specified by its ID. Use this to match * incoming URIs or to construct an Intent.*/
        public static final Uri CONTENT_ID_URI_PATTERN = Uri.parse(SCHEME + AUTHORITY + PATH_NOTE_ID + "/#");

        
        public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.arp.ShopList";
        public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.arp.ShopList";

        
        public static final String DEFAULT_SORT_ORDER = "Name ASC";

		
		public static String CREATE_TABLE_SQL = 
				"create table " + TABLE_NAME + " (" +
				_ID + " integer primary key autoincrement, " +
				_NAME + " text not null);";
	}
	
	
	private static final String SCHEME = "content://";
	
	public static final class ShopListItem implements BaseColumns {
		public static String _PRODUCT_ID = "Product_id";
		public static String _SHOPLIST_ID = "Shoplist_id"; 
		public static String _Quantity = "Quantity";
		public static String _Bought = "Bought";
		public static String _BoughtPrice = "BoughtPrice";
		
		public static final String TABLE_NAME = "ShopListItem";
		

        /**
         * Path parts for the URIs
         */

        private static final String PATH_NOTES = "/ShopListItem";
        private static final String PATH_NOTE_ID = "/ShopListItem/";
        /*** 0-relative position of a note ID segment in the path part of a note ID URI */
        public static final int NAME_ID_PATH_POSITION = 1;
        
        /*** The content:// style URL for this table*/
        public static final Uri CONTENT_URI =  Uri.parse(SCHEME + AUTHORITY + PATH_NOTES);

        /*** The content URI base for a single note. Callers must * append a numeric note id to this Uri to retrieve a note */
        public static final Uri CONTENT_ID_URI_BASE = Uri.parse(SCHEME + AUTHORITY + PATH_NOTE_ID);

        /*** The content URI match pattern for a single note, specified by its ID. Use this to match * incoming URIs or to construct an Intent.*/
        public static final Uri CONTENT_ID_URI_PATTERN = Uri.parse(SCHEME + AUTHORITY + PATH_NOTE_ID + "/#");

        
        public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.arp.ShopListItem";
        public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.arp.ShopListItem";

        
        public static final String DEFAULT_SORT_ORDER = "Bought ASC, Name ASC";

        public static String CREATE_TABLE_SQL = 
				"create table " + TABLE_NAME + " (" +
				_ID + " integer primary key autoincrement, " +
		        _PRODUCT_ID+ " integer not null, " +
				_SHOPLIST_ID + " integer not null, " + 
				_Quantity + " integer not null, " +
				_Bought + " boolean not null, " + //int(0 = false, 1 = true);
				_BoughtPrice + " DECIMAL(5,2)" + 
				 ");";
        
        
        
	}
	
	public static final class Product implements BaseColumns {
		public static String _NAME = "Name";
		public static String _PRICE = "Price";
		public static String _UNITOFQUANTITY = "UnitOfQuantity";
		
		public static final String TABLE_NAME = "Product";
		
		
		/**
         * Path parts for the URIs
         */

        private static final String PATH_NOTES = "/Product";
        private static final String PATH_NOTE_ID = "/Product/";
        /*** 0-relative position of a note ID segment in the path part of a note ID URI */
        public static final int NAME_ID_PATH_POSITION = 1;
        
        /*** The content:// style URL for this table*/
        public static final Uri CONTENT_URI =  Uri.parse(SCHEME + AUTHORITY + PATH_NOTES);

        /*** The content URI base for a single note. Callers must * append a numeric note id to this Uri to retrieve a note */
        public static final Uri CONTENT_ID_URI_BASE = Uri.parse(SCHEME + AUTHORITY + PATH_NOTE_ID);

        /*** The content URI match pattern for a single note, specified by its ID. Use this to match * incoming URIs or to construct an Intent.*/
        public static final Uri CONTENT_ID_URI_PATTERN = Uri.parse(SCHEME + AUTHORITY + PATH_NOTE_ID + "/#");

        
        public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.arp.Product";
        public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.arp.Product";

        
        public static final String DEFAULT_SORT_ORDER = "Name ASC";
		
        public static String CREATE_TABLE_SQL = 
				"create table " + TABLE_NAME + " (" +
				_ID + " integer primary key autoincrement, " +
		        _NAME + " text not null, " +
				_PRICE + " DECIMAL(5,2), " +
				_UNITOFQUANTITY + " text not null" +
				 ");";
        
	}

}
